import axios from 'axios'

const instance = axios.create({
  baseURL: '/api',
  timeout: 2000
})

const server = 'micro-app/v1'

// 删除文章
export function postDelArticle(body: any) {
  return instance.post(`${server}/postDelArticle`, body)
}

// 查询文章列表
export function postQueryArticle(body: any = {}) {
  return instance.post(`${server}/postQueryArticle`, body)
}

export function postQueryCategory(body = null) {
  return instance.post(`${server}/postQueryCategory`, body)
}

export function postCreateCategory(body: any) {
  return instance.post(`${server}/postCreateCategory`, body)
}

// 保存文章
export function postSaveArticle(body: any) {
  return instance.post(`${server}/postSaveArticle`, body)
}

export function getArticleById(uid: string) {
  return instance.get(`${server}/article/:uid`, { params: { uid } })
}
